﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using PAT.Entities;
using PAT.Data;

#endregion

namespace PAT.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="PatUsuarioProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class PatUsuarioProviderBaseCore : EntityProviderBase<PAT.Entities.PatUsuario, PAT.Entities.PatUsuarioKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByIdRolFromPatUsuarioRol
		
		/// <summary>
		///		Gets PAT_USUARIO objects from the datasource by ID_ROL in the
		///		PAT_USUARIO_ROL table. Table PAT_USUARIO is related to table PAT_ROL
		///		through the (M:N) relationship defined in the PAT_USUARIO_ROL table.
		/// </summary>
		/// <param name="_idRol"></param>
		/// <returns>Returns a typed collection of PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdRolFromPatUsuarioRol(System.Int16 _idRol)
		{
			int count = -1;
			return GetByIdRolFromPatUsuarioRol(null,_idRol, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets PAT.Entities.PatUsuario objects from the datasource by ID_ROL in the
		///		PAT_USUARIO_ROL table. Table PAT_USUARIO is related to table PAT_ROL
		///		through the (M:N) relationship defined in the PAT_USUARIO_ROL table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idRol"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdRolFromPatUsuarioRol(System.Int16 _idRol, int start, int pageLength)
		{
			int count = -1;
			return GetByIdRolFromPatUsuarioRol(null, _idRol, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatUsuario objects from the datasource by ID_ROL in the
		///		PAT_USUARIO_ROL table. Table PAT_USUARIO is related to table PAT_ROL
		///		through the (M:N) relationship defined in the PAT_USUARIO_ROL table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idRol"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_USUARIO objects.</returns>
		public TList<PatUsuario> GetByIdRolFromPatUsuarioRol(TransactionManager transactionManager, System.Int16 _idRol)
		{
			int count = -1;
			return GetByIdRolFromPatUsuarioRol(transactionManager, _idRol, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets PatUsuario objects from the datasource by ID_ROL in the
		///		PAT_USUARIO_ROL table. Table PAT_USUARIO is related to table PAT_ROL
		///		through the (M:N) relationship defined in the PAT_USUARIO_ROL table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idRol"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_USUARIO objects.</returns>
		public TList<PatUsuario> GetByIdRolFromPatUsuarioRol(TransactionManager transactionManager, System.Int16 _idRol,int start, int pageLength)
		{
			int count = -1;
			return GetByIdRolFromPatUsuarioRol(transactionManager, _idRol, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatUsuario objects from the datasource by ID_ROL in the
		///		PAT_USUARIO_ROL table. Table PAT_USUARIO is related to table PAT_ROL
		///		through the (M:N) relationship defined in the PAT_USUARIO_ROL table.
		/// </summary>
		/// <param name="_idRol"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_USUARIO objects.</returns>
		public TList<PatUsuario> GetByIdRolFromPatUsuarioRol(System.Int16 _idRol,int start, int pageLength, out int count)
		{
			
			return GetByIdRolFromPatUsuarioRol(null, _idRol, start, pageLength, out count);
		}


		/// <summary>
		///		Gets PAT_USUARIO objects from the datasource by ID_ROL in the
		///		PAT_USUARIO_ROL table. Table PAT_USUARIO is related to table PAT_ROL
		///		through the (M:N) relationship defined in the PAT_USUARIO_ROL table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_idRol"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatUsuario objects.</returns>
		public abstract TList<PatUsuario> GetByIdRolFromPatUsuarioRol(TransactionManager transactionManager,System.Int16 _idRol, int start, int pageLength, out int count);
		
		#endregion GetByIdRolFromPatUsuarioRol
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, PAT.Entities.PatUsuarioKey key)
		{
			return Delete(transactionManager, key.IdUsuario);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_idUsuario">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _idUsuario)
		{
			return Delete(null, _idUsuario);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idUsuario">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _idUsuario);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_EMPRESA key.
		///		FK_PAT_USUARIO_PAT_EMPRESA Description: 
		/// </summary>
		/// <param name="_idEmpresa"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdEmpresa(System.Int32 _idEmpresa)
		{
			int count = -1;
			return GetByIdEmpresa(_idEmpresa, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_EMPRESA key.
		///		FK_PAT_USUARIO_PAT_EMPRESA Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idEmpresa"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		/// <remarks></remarks>
		public TList<PatUsuario> GetByIdEmpresa(TransactionManager transactionManager, System.Int32 _idEmpresa)
		{
			int count = -1;
			return GetByIdEmpresa(transactionManager, _idEmpresa, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_EMPRESA key.
		///		FK_PAT_USUARIO_PAT_EMPRESA Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idEmpresa"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdEmpresa(TransactionManager transactionManager, System.Int32 _idEmpresa, int start, int pageLength)
		{
			int count = -1;
			return GetByIdEmpresa(transactionManager, _idEmpresa, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_EMPRESA key.
		///		fkPatUsuarioPatEmpresa Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idEmpresa"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdEmpresa(System.Int32 _idEmpresa, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdEmpresa(null, _idEmpresa, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_EMPRESA key.
		///		fkPatUsuarioPatEmpresa Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idEmpresa"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdEmpresa(System.Int32 _idEmpresa, int start, int pageLength,out int count)
		{
			return GetByIdEmpresa(null, _idEmpresa, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_EMPRESA key.
		///		FK_PAT_USUARIO_PAT_EMPRESA Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idEmpresa"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public abstract TList<PatUsuario> GetByIdEmpresa(TransactionManager transactionManager, System.Int32 _idEmpresa, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION key.
		///		FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION Description: 
		/// </summary>
		/// <param name="_idTipoIdentificacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdTipoIdentificacion(System.Int16 _idTipoIdentificacion)
		{
			int count = -1;
			return GetByIdTipoIdentificacion(_idTipoIdentificacion, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION key.
		///		FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoIdentificacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		/// <remarks></remarks>
		public TList<PatUsuario> GetByIdTipoIdentificacion(TransactionManager transactionManager, System.Int16 _idTipoIdentificacion)
		{
			int count = -1;
			return GetByIdTipoIdentificacion(transactionManager, _idTipoIdentificacion, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION key.
		///		FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoIdentificacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdTipoIdentificacion(TransactionManager transactionManager, System.Int16 _idTipoIdentificacion, int start, int pageLength)
		{
			int count = -1;
			return GetByIdTipoIdentificacion(transactionManager, _idTipoIdentificacion, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION key.
		///		fkPatUsuarioPatTipoIdentificacion Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoIdentificacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdTipoIdentificacion(System.Int16 _idTipoIdentificacion, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdTipoIdentificacion(null, _idTipoIdentificacion, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION key.
		///		fkPatUsuarioPatTipoIdentificacion Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoIdentificacion"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdTipoIdentificacion(System.Int16 _idTipoIdentificacion, int start, int pageLength,out int count)
		{
			return GetByIdTipoIdentificacion(null, _idTipoIdentificacion, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION key.
		///		FK_PAT_USUARIO_PAT_TIPO_IDENTIFICACION Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoIdentificacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public abstract TList<PatUsuario> GetByIdTipoIdentificacion(TransactionManager transactionManager, System.Int16 _idTipoIdentificacion, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA key.
		///		FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA Description: 
		/// </summary>
		/// <param name="_idUbicacionCiudad"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdUbicacionCiudad(System.Int32 _idUbicacionCiudad)
		{
			int count = -1;
			return GetByIdUbicacionCiudad(_idUbicacionCiudad, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA key.
		///		FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idUbicacionCiudad"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		/// <remarks></remarks>
		public TList<PatUsuario> GetByIdUbicacionCiudad(TransactionManager transactionManager, System.Int32 _idUbicacionCiudad)
		{
			int count = -1;
			return GetByIdUbicacionCiudad(transactionManager, _idUbicacionCiudad, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA key.
		///		FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idUbicacionCiudad"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdUbicacionCiudad(TransactionManager transactionManager, System.Int32 _idUbicacionCiudad, int start, int pageLength)
		{
			int count = -1;
			return GetByIdUbicacionCiudad(transactionManager, _idUbicacionCiudad, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA key.
		///		fkPatUsuarioPatUbicacionGeografica Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idUbicacionCiudad"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdUbicacionCiudad(System.Int32 _idUbicacionCiudad, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdUbicacionCiudad(null, _idUbicacionCiudad, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA key.
		///		fkPatUsuarioPatUbicacionGeografica Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idUbicacionCiudad"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public TList<PatUsuario> GetByIdUbicacionCiudad(System.Int32 _idUbicacionCiudad, int start, int pageLength,out int count)
		{
			return GetByIdUbicacionCiudad(null, _idUbicacionCiudad, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA key.
		///		FK_PAT_USUARIO_PAT_UBICACION_GEOGRAFICA Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idUbicacionCiudad"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatUsuario objects.</returns>
		public abstract TList<PatUsuario> GetByIdUbicacionCiudad(TransactionManager transactionManager, System.Int32 _idUbicacionCiudad, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override PAT.Entities.PatUsuario Get(TransactionManager transactionManager, PAT.Entities.PatUsuarioKey key, int start, int pageLength)
		{
			return GetByIdUsuario(transactionManager, key.IdUsuario, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_PAT_USUARIO index.
		/// </summary>
		/// <param name="_idUsuario"></param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatUsuario"/> class.</returns>
		public PAT.Entities.PatUsuario GetByIdUsuario(System.Int32 _idUsuario)
		{
			int count = -1;
			return GetByIdUsuario(null,_idUsuario, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_USUARIO index.
		/// </summary>
		/// <param name="_idUsuario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatUsuario"/> class.</returns>
		public PAT.Entities.PatUsuario GetByIdUsuario(System.Int32 _idUsuario, int start, int pageLength)
		{
			int count = -1;
			return GetByIdUsuario(null, _idUsuario, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_USUARIO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idUsuario"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatUsuario"/> class.</returns>
		public PAT.Entities.PatUsuario GetByIdUsuario(TransactionManager transactionManager, System.Int32 _idUsuario)
		{
			int count = -1;
			return GetByIdUsuario(transactionManager, _idUsuario, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_USUARIO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idUsuario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatUsuario"/> class.</returns>
		public PAT.Entities.PatUsuario GetByIdUsuario(TransactionManager transactionManager, System.Int32 _idUsuario, int start, int pageLength)
		{
			int count = -1;
			return GetByIdUsuario(transactionManager, _idUsuario, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_USUARIO index.
		/// </summary>
		/// <param name="_idUsuario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatUsuario"/> class.</returns>
		public PAT.Entities.PatUsuario GetByIdUsuario(System.Int32 _idUsuario, int start, int pageLength, out int count)
		{
			return GetByIdUsuario(null, _idUsuario, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_USUARIO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idUsuario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatUsuario"/> class.</returns>
		public abstract PAT.Entities.PatUsuario GetByIdUsuario(TransactionManager transactionManager, System.Int32 _idUsuario, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;PatUsuario&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;PatUsuario&gt;"/></returns>
		public static TList<PatUsuario> Fill(IDataReader reader, TList<PatUsuario> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				PAT.Entities.PatUsuario c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("PatUsuario")
					.Append("|").Append((System.Int32)reader[((int)PatUsuarioColumn.IdUsuario - 1)]).ToString();
					c = EntityManager.LocateOrCreate<PatUsuario>(
					key.ToString(), // EntityTrackingKey
					"PatUsuario",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new PAT.Entities.PatUsuario();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.IdUsuario = (System.Int32)reader[((int)PatUsuarioColumn.IdUsuario - 1)];
					c.IdTipoIdentificacion = (System.Int16)reader[((int)PatUsuarioColumn.IdTipoIdentificacion - 1)];
					c.NumeroIdentificacion = (System.String)reader[((int)PatUsuarioColumn.NumeroIdentificacion - 1)];
					c.Nombres = (System.String)reader[((int)PatUsuarioColumn.Nombres - 1)];
					c.Apellidos = (System.String)reader[((int)PatUsuarioColumn.Apellidos - 1)];
					c.IdEmpresa = (System.Int32)reader[((int)PatUsuarioColumn.IdEmpresa - 1)];
					c.Direccion = (System.String)reader[((int)PatUsuarioColumn.Direccion - 1)];
					c.TelefonoFijo = (System.String)reader[((int)PatUsuarioColumn.TelefonoFijo - 1)];
					c.TelefonoMovil = (reader.IsDBNull(((int)PatUsuarioColumn.TelefonoMovil - 1)))?null:(System.String)reader[((int)PatUsuarioColumn.TelefonoMovil - 1)];
					c.EMail = (reader.IsDBNull(((int)PatUsuarioColumn.EMail - 1)))?null:(System.String)reader[((int)PatUsuarioColumn.EMail - 1)];
					c.Login = (System.String)reader[((int)PatUsuarioColumn.Login - 1)];
					c.Password = (System.String)reader[((int)PatUsuarioColumn.Password - 1)];
					c.IdUbicacionCiudad = (System.Int32)reader[((int)PatUsuarioColumn.IdUbicacionCiudad - 1)];
					c.CargoEmpresa = (System.String)reader[((int)PatUsuarioColumn.CargoEmpresa - 1)];
					c.IdEstado = (System.Int16)reader[((int)PatUsuarioColumn.IdEstado - 1)];
					c.Activo = (System.Boolean)reader[((int)PatUsuarioColumn.Activo - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatUsuario"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatUsuario"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, PAT.Entities.PatUsuario entity)
		{
			if (!reader.Read()) return;
			
			entity.IdUsuario = (System.Int32)reader[((int)PatUsuarioColumn.IdUsuario - 1)];
			entity.IdTipoIdentificacion = (System.Int16)reader[((int)PatUsuarioColumn.IdTipoIdentificacion - 1)];
			entity.NumeroIdentificacion = (System.String)reader[((int)PatUsuarioColumn.NumeroIdentificacion - 1)];
			entity.Nombres = (System.String)reader[((int)PatUsuarioColumn.Nombres - 1)];
			entity.Apellidos = (System.String)reader[((int)PatUsuarioColumn.Apellidos - 1)];
			entity.IdEmpresa = (System.Int32)reader[((int)PatUsuarioColumn.IdEmpresa - 1)];
			entity.Direccion = (System.String)reader[((int)PatUsuarioColumn.Direccion - 1)];
			entity.TelefonoFijo = (System.String)reader[((int)PatUsuarioColumn.TelefonoFijo - 1)];
			entity.TelefonoMovil = (reader.IsDBNull(((int)PatUsuarioColumn.TelefonoMovil - 1)))?null:(System.String)reader[((int)PatUsuarioColumn.TelefonoMovil - 1)];
			entity.EMail = (reader.IsDBNull(((int)PatUsuarioColumn.EMail - 1)))?null:(System.String)reader[((int)PatUsuarioColumn.EMail - 1)];
			entity.Login = (System.String)reader[((int)PatUsuarioColumn.Login - 1)];
			entity.Password = (System.String)reader[((int)PatUsuarioColumn.Password - 1)];
			entity.IdUbicacionCiudad = (System.Int32)reader[((int)PatUsuarioColumn.IdUbicacionCiudad - 1)];
			entity.CargoEmpresa = (System.String)reader[((int)PatUsuarioColumn.CargoEmpresa - 1)];
			entity.IdEstado = (System.Int16)reader[((int)PatUsuarioColumn.IdEstado - 1)];
			entity.Activo = (System.Boolean)reader[((int)PatUsuarioColumn.Activo - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatUsuario"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatUsuario"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, PAT.Entities.PatUsuario entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.IdUsuario = (System.Int32)dataRow["ID_USUARIO"];
			entity.IdTipoIdentificacion = (System.Int16)dataRow["ID_TIPO_IDENTIFICACION"];
			entity.NumeroIdentificacion = (System.String)dataRow["NUMERO_IDENTIFICACION"];
			entity.Nombres = (System.String)dataRow["NOMBRES"];
			entity.Apellidos = (System.String)dataRow["APELLIDOS"];
			entity.IdEmpresa = (System.Int32)dataRow["ID_EMPRESA"];
			entity.Direccion = (System.String)dataRow["DIRECCION"];
			entity.TelefonoFijo = (System.String)dataRow["TELEFONO_FIJO"];
			entity.TelefonoMovil = Convert.IsDBNull(dataRow["TELEFONO_MOVIL"]) ? null : (System.String)dataRow["TELEFONO_MOVIL"];
			entity.EMail = Convert.IsDBNull(dataRow["E_MAIL"]) ? null : (System.String)dataRow["E_MAIL"];
			entity.Login = (System.String)dataRow["LOGIN"];
			entity.Password = (System.String)dataRow["PASSWORD"];
			entity.IdUbicacionCiudad = (System.Int32)dataRow["ID_UBICACION_CIUDAD"];
			entity.CargoEmpresa = (System.String)dataRow["CARGO_EMPRESA"];
			entity.IdEstado = (System.Int16)dataRow["ID_ESTADO"];
			entity.Activo = (System.Boolean)dataRow["ACTIVO"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatUsuario"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">PAT.Entities.PatUsuario Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, PAT.Entities.PatUsuario entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region IdEmpresaSource	
			if (CanDeepLoad(entity, "PatEmpresa|IdEmpresaSource", deepLoadType, innerList) 
				&& entity.IdEmpresaSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdEmpresa;
				PatEmpresa tmpEntity = EntityManager.LocateEntity<PatEmpresa>(EntityLocator.ConstructKeyFromPkItems(typeof(PatEmpresa), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdEmpresaSource = tmpEntity;
				else
					entity.IdEmpresaSource = DataRepository.PatEmpresaProvider.GetByIdEmpresa(transactionManager, entity.IdEmpresa);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdEmpresaSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdEmpresaSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatEmpresaProvider.DeepLoad(transactionManager, entity.IdEmpresaSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdEmpresaSource

			#region IdTipoIdentificacionSource	
			if (CanDeepLoad(entity, "PatTipoIdentificacion|IdTipoIdentificacionSource", deepLoadType, innerList) 
				&& entity.IdTipoIdentificacionSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdTipoIdentificacion;
				PatTipoIdentificacion tmpEntity = EntityManager.LocateEntity<PatTipoIdentificacion>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTipoIdentificacion), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdTipoIdentificacionSource = tmpEntity;
				else
					entity.IdTipoIdentificacionSource = DataRepository.PatTipoIdentificacionProvider.GetByIdTipoIdentificacion(transactionManager, entity.IdTipoIdentificacion);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdTipoIdentificacionSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdTipoIdentificacionSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTipoIdentificacionProvider.DeepLoad(transactionManager, entity.IdTipoIdentificacionSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdTipoIdentificacionSource

			#region IdUbicacionCiudadSource	
			if (CanDeepLoad(entity, "PatUbicacionGeografica|IdUbicacionCiudadSource", deepLoadType, innerList) 
				&& entity.IdUbicacionCiudadSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdUbicacionCiudad;
				PatUbicacionGeografica tmpEntity = EntityManager.LocateEntity<PatUbicacionGeografica>(EntityLocator.ConstructKeyFromPkItems(typeof(PatUbicacionGeografica), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdUbicacionCiudadSource = tmpEntity;
				else
					entity.IdUbicacionCiudadSource = DataRepository.PatUbicacionGeograficaProvider.GetByIdUbicacion(transactionManager, entity.IdUbicacionCiudad);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdUbicacionCiudadSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdUbicacionCiudadSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatUbicacionGeograficaProvider.DeepLoad(transactionManager, entity.IdUbicacionCiudadSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdUbicacionCiudadSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByIdUsuario methods when available
			
			#region PatUsuarioRolCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatUsuarioRol>|PatUsuarioRolCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatUsuarioRolCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatUsuarioRolCollection = DataRepository.PatUsuarioRolProvider.GetByIdUsuario(transactionManager, entity.IdUsuario);

				if (deep && entity.PatUsuarioRolCollection.Count > 0)
				{
					deepHandles.Add("PatUsuarioRolCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatUsuarioRol>) DataRepository.PatUsuarioRolProvider.DeepLoad,
						new object[] { transactionManager, entity.PatUsuarioRolCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region IdRolPatRolCollection_From_PatUsuarioRol
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<PatRol>|IdRolPatRolCollection_From_PatUsuarioRol", deepLoadType, innerList))
			{
				entity.IdRolPatRolCollection_From_PatUsuarioRol = DataRepository.PatRolProvider.GetByIdUsuarioFromPatUsuarioRol(transactionManager, entity.IdUsuario);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdRolPatRolCollection_From_PatUsuarioRol' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdRolPatRolCollection_From_PatUsuarioRol != null)
				{
					deepHandles.Add("IdRolPatRolCollection_From_PatUsuarioRol",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< PatRol >) DataRepository.PatRolProvider.DeepLoad,
						new object[] { transactionManager, entity.IdRolPatRolCollection_From_PatUsuarioRol, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the PAT.Entities.PatUsuario object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">PAT.Entities.PatUsuario instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">PAT.Entities.PatUsuario Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, PAT.Entities.PatUsuario entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region IdEmpresaSource
			if (CanDeepSave(entity, "PatEmpresa|IdEmpresaSource", deepSaveType, innerList) 
				&& entity.IdEmpresaSource != null)
			{
				DataRepository.PatEmpresaProvider.Save(transactionManager, entity.IdEmpresaSource);
				entity.IdEmpresa = entity.IdEmpresaSource.IdEmpresa;
			}
			#endregion 
			
			#region IdTipoIdentificacionSource
			if (CanDeepSave(entity, "PatTipoIdentificacion|IdTipoIdentificacionSource", deepSaveType, innerList) 
				&& entity.IdTipoIdentificacionSource != null)
			{
				DataRepository.PatTipoIdentificacionProvider.Save(transactionManager, entity.IdTipoIdentificacionSource);
				entity.IdTipoIdentificacion = entity.IdTipoIdentificacionSource.IdTipoIdentificacion;
			}
			#endregion 
			
			#region IdUbicacionCiudadSource
			if (CanDeepSave(entity, "PatUbicacionGeografica|IdUbicacionCiudadSource", deepSaveType, innerList) 
				&& entity.IdUbicacionCiudadSource != null)
			{
				DataRepository.PatUbicacionGeograficaProvider.Save(transactionManager, entity.IdUbicacionCiudadSource);
				entity.IdUbicacionCiudad = entity.IdUbicacionCiudadSource.IdUbicacion;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();

			#region IdRolPatRolCollection_From_PatUsuarioRol>
			if (CanDeepSave(entity.IdRolPatRolCollection_From_PatUsuarioRol, "List<PatRol>|IdRolPatRolCollection_From_PatUsuarioRol", deepSaveType, innerList))
			{
				if (entity.IdRolPatRolCollection_From_PatUsuarioRol.Count > 0 || entity.IdRolPatRolCollection_From_PatUsuarioRol.DeletedItems.Count > 0)
				{
					DataRepository.PatRolProvider.Save(transactionManager, entity.IdRolPatRolCollection_From_PatUsuarioRol); 
					deepHandles.Add("IdRolPatRolCollection_From_PatUsuarioRol",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<PatRol>) DataRepository.PatRolProvider.DeepSave,
						new object[] { transactionManager, entity.IdRolPatRolCollection_From_PatUsuarioRol, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 
	
			#region List<PatUsuarioRol>
				if (CanDeepSave(entity.PatUsuarioRolCollection, "List<PatUsuarioRol>|PatUsuarioRolCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatUsuarioRol child in entity.PatUsuarioRolCollection)
					{
						if(child.IdUsuarioSource != null)
						{
								child.IdUsuario = child.IdUsuarioSource.IdUsuario;
						}

						if(child.IdRolSource != null)
						{
								child.IdRol = child.IdRolSource.IdRol;
						}

					}

					if (entity.PatUsuarioRolCollection.Count > 0 || entity.PatUsuarioRolCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatUsuarioRolProvider.Save(transactionManager, entity.PatUsuarioRolCollection);
						
						deepHandles.Add("PatUsuarioRolCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatUsuarioRol >) DataRepository.PatUsuarioRolProvider.DeepSave,
							new object[] { transactionManager, entity.PatUsuarioRolCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region PatUsuarioChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>PAT.Entities.PatUsuario</c>
	///</summary>
	public enum PatUsuarioChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>PatEmpresa</c> at IdEmpresaSource
		///</summary>
		[ChildEntityType(typeof(PatEmpresa))]
		PatEmpresa,
			
		///<summary>
		/// Composite Property for <c>PatTipoIdentificacion</c> at IdTipoIdentificacionSource
		///</summary>
		[ChildEntityType(typeof(PatTipoIdentificacion))]
		PatTipoIdentificacion,
			
		///<summary>
		/// Composite Property for <c>PatUbicacionGeografica</c> at IdUbicacionCiudadSource
		///</summary>
		[ChildEntityType(typeof(PatUbicacionGeografica))]
		PatUbicacionGeografica,
	
		///<summary>
		/// Collection of <c>PatUsuario</c> as OneToMany for PatUsuarioRolCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatUsuarioRol>))]
		PatUsuarioRolCollection,

		///<summary>
		/// Collection of <c>PatUsuario</c> as ManyToMany for PatRolCollection_From_PatUsuarioRol
		///</summary>
		[ChildEntityType(typeof(TList<PatRol>))]
		IdRolPatRolCollection_From_PatUsuarioRol,
	}
	
	#endregion PatUsuarioChildEntityTypes
	
	#region PatUsuarioFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;PatUsuarioColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatUsuario"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatUsuarioFilterBuilder : SqlFilterBuilder<PatUsuarioColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatUsuarioFilterBuilder class.
		/// </summary>
		public PatUsuarioFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatUsuarioFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatUsuarioFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatUsuarioFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatUsuarioFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatUsuarioFilterBuilder
	
	#region PatUsuarioParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;PatUsuarioColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatUsuario"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatUsuarioParameterBuilder : ParameterizedSqlFilterBuilder<PatUsuarioColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatUsuarioParameterBuilder class.
		/// </summary>
		public PatUsuarioParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatUsuarioParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatUsuarioParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatUsuarioParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatUsuarioParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatUsuarioParameterBuilder
	
	#region PatUsuarioSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;PatUsuarioColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatUsuario"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class PatUsuarioSortBuilder : SqlSortBuilder<PatUsuarioColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatUsuarioSqlSortBuilder class.
		/// </summary>
		public PatUsuarioSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion PatUsuarioSortBuilder
	
} // end namespace
